USE [BABELE_SISM_SVIL]
GO

/****** Object:  Table [dbo].[SISM_EVENTI_PROG_CONTATTO]    Script Date: 12/20/2013 10:04:27 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[SISM_EVENTI_PROG_CONTATTO](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[FK_ID_CONTATTO] [int] NOT NULL,
	[ID_PROG_FLUSSO] [int] NULL,
	[FK_COD_T_ATTI_SISM] [int] NULL,
	[FK_ID_SISM_T_TERAPIA_FARMACO] [int] NULL,
	[DATA_INSERIMENTO] [datetime] NOT NULL,
 CONSTRAINT [PK_SISM_EVENTI_PROG_CONTATTO] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[SISM_EVENTI_PROG_CONTATTO]  WITH CHECK ADD  CONSTRAINT [FK_SISM_EVENTI_PROG_CONTATTO_SISM_T_ATTI] FOREIGN KEY([FK_COD_T_ATTI_SISM])
REFERENCES [dbo].[SISM_T_ATTI] ([COD_T_ATTI_SISM])
GO

ALTER TABLE [dbo].[SISM_EVENTI_PROG_CONTATTO] CHECK CONSTRAINT [FK_SISM_EVENTI_PROG_CONTATTO_SISM_T_ATTI]
GO

ALTER TABLE [dbo].[SISM_EVENTI_PROG_CONTATTO]  WITH CHECK ADD  CONSTRAINT [FK_SISM_EVENTI_PROG_CONTATTO_SISM_T_CONTATTI] FOREIGN KEY([FK_ID_CONTATTO])
REFERENCES [dbo].[SISM_T_CONTATTI] ([COD_T_CONTATTI_SISM])
GO

ALTER TABLE [dbo].[SISM_EVENTI_PROG_CONTATTO] CHECK CONSTRAINT [FK_SISM_EVENTI_PROG_CONTATTO_SISM_T_CONTATTI]
GO

ALTER TABLE [dbo].[SISM_EVENTI_PROG_CONTATTO]  WITH CHECK ADD  CONSTRAINT [FK_SISM_EVENTI_PROG_CONTATTO_SISM_T_TERAPIA_FARMACO] FOREIGN KEY([FK_ID_SISM_T_TERAPIA_FARMACO])
REFERENCES [dbo].[SISM_T_TERAPIA_FARMACO] ([id])
GO

ALTER TABLE [dbo].[SISM_EVENTI_PROG_CONTATTO] CHECK CONSTRAINT [FK_SISM_EVENTI_PROG_CONTATTO_SISM_T_TERAPIA_FARMACO]
GO

ALTER TABLE [dbo].[SISM_EVENTI_PROG_CONTATTO] ADD  CONSTRAINT [DF_SISM_EVENTI_PROG_CONTATTO_DATA_INSERIMENTO]  DEFAULT (getdate()) FOR [DATA_INSERIMENTO]
GO


